<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditPersonTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2" cellpadding="10" cellspacing="10">
                    <h:outputLabel value="#{bundle.EditPersonLabel_perID}" for="perID" />
                    
                    <h:outputText id="perID" value="#{personController.selected.perID}" title="#{bundle.EditPersonTitle_perID}" required="true" requiredMessage="#{bundle.EditPersonRequiredMessage_perID}"/>
                    <h:outputLabel value="#{bundle.EditPersonLabel_firstName}" for="firstName" />
                    <h:inputText id="firstName" value="#{personController.selected.firstName}" title="#{bundle.EditPersonTitle_firstName}" />
                    <h:outputLabel value="#{bundle.EditPersonLabel_lastName}" for="lastName" />
                    <h:inputText id="lastName" value="#{personController.selected.lastName}" title="#{bundle.EditPersonTitle_lastName}" />
                    <h:outputLabel value="#{bundle.EditPersonLabel_gender}" for="gender" />
                    <p:selectBooleanButton id="gender" value="#{personController.selected.gender}" onLabel="Male" offLabel="Female" onIcon="ui-icon-check" offIcon="ui-icon-close"/>
                                  
                    <h:outputLabel value="#{bundle.EditPersonLabel_dateOfBirth}" for="dateOfBirth" />
                    <h:inputText id="dateOfBirth" value="#{personController.selected.dateOfBirth}" title="#{bundle.EditPersonTitle_dateOfBirth}" >
                        <f:convertDateTime pattern="MM/dd/yyyy" /> <!-- MM/dd/yyyy HH:mm:ss-->
                    </h:inputText>
                    <h:outputLabel value="#{bundle.EditPersonLabel_address}" for="address" />
                    <h:inputTextarea id="address" value="#{personController.selected.address}" title="#{bundle.EditPersonTitle_address}" />
                    <h:outputLabel value="#{bundle.EditPersonLabel_phone}" for="phone" />
                    <h:inputText id="phone" value="#{personController.selected.phone}" title="#{bundle.EditPersonTitle_phone}" />
                    <h:outputLabel value="#{bundle.EditPersonLabel_cardNo}" for="cardNo" />
                    <h:inputText id="cardNo" value="#{personController.selected.cardNo}" title="#{bundle.EditPersonTitle_cardNo}" />
                    <h:outputLabel value="#{bundle.EditPersonLabel_isVisiable}" for="isVisiable" />
                    <p:selectBooleanButton id="isActive" value="#{accountController.selected.isActive}" onLabel="Is Active" offLabel="Not Active" onIcon="ui-icon-check" offIcon="ui-icon-close"/>
                    <!--
                    <h:inputText id="isVisiable" value="#{personController.selected.isVisiable}" title="#{bundle.EditPersonTitle_isVisiable}" />
                    
                    <h:inputText id="isVisiable" value="#{personController.selected.isVisiable}" title="#{bundle.EditPersonTitle_isVisiable}" />
                    <h:outputLabel value="#{bundle.EditPersonLabel_student}" for="student" />
                    <h:selectOneMenu id="student" value="#{personController.selected.student}" title="#{bundle.EditPersonTitle_student}" >
                        <f:selectItems value="#{studentController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.EditPersonLabel_speaker}" for="speaker" />
                    <h:selectOneMenu id="speaker" value="#{personController.selected.speaker}" title="#{bundle.EditPersonTitle_speaker}" >
                        <f:selectItems value="#{speakerController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.EditPersonLabel_cardTypeID}" for="cardTypeID" />
                    <h:selectOneMenu id="cardTypeID" value="#{personController.selected.cardTypeID}" title="#{bundle.EditPersonTitle_cardTypeID}" >
                        <f:selectItems value="#{cardTypeController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    -->
                </h:panelGrid>
                <br/>
                <h:commandLink action="#{personController.update}" value="#{bundle.EditPersonSaveLink}"/>
                <br />
                <br />
                <h:commandLink action="View" value="#{bundle.EditPersonViewLink}" immediate="true"/>
                <br />
                <h:commandLink action="#{personController.prepareList}" value="#{bundle.EditPersonShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.EditPersonIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
